Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@turf/boolean-intersects

Package Overview
Dependencies
Maintainers
9
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/boolean-intersects

turf boolean-intersects module

  • 7.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
220K
decreased by-39.82%
Maintainers
9
Weekly downloads
 
Created

What is @turf/boolean-intersects?

@turf/boolean-intersects is a module from the Turf.js library that provides geospatial analysis tools. This specific module is used to determine if two geometries intersect. It supports various types of geometries including points, lines, and polygons.

What are @turf/boolean-intersects's main functionalities?

Check if two polygons intersect

This feature checks if two polygons intersect. The code sample creates two polygons and uses the booleanIntersects function to determine if they intersect.

const turf = require('@turf/turf');

const polygon1 = turf.polygon([[
  [-2, 2],
  [2, 2],
  [2, -2],
  [-2, -2],
  [-2, 2]
]]);

const polygon2 = turf.polygon([[
  [1, 1],
  [3, 1],
  [3, -1],
  [1, -1],
  [1, 1]
]]);

const intersects = turf.booleanIntersects(polygon1, polygon2);
console.log(intersects); // true

Check if a line intersects a polygon

This feature checks if a line intersects a polygon. The code sample creates a line and a polygon and uses the booleanIntersects function to determine if they intersect.

const turf = require('@turf/turf');

const line = turf.lineString([
  [-1, 0],
  [1, 0]
]);

const polygon = turf.polygon([[
  [-2, 2],
  [2, 2],
  [2, -2],
  [-2, -2],
  [-2, 2]
]]);

const intersects = turf.booleanIntersects(line, polygon);
console.log(intersects); // true

Check if a point intersects a polygon

This feature checks if a point intersects a polygon. The code sample creates a point and a polygon and uses the booleanIntersects function to determine if they intersect.

const turf = require('@turf/turf');

const point = turf.point([1, 1]);

const polygon = turf.polygon([[
  [-2, 2],
  [2, 2],
  [2, -2],
  [-2, -2],
  [-2, 2]
]]);

const intersects = turf.booleanIntersects(point, polygon);
console.log(intersects); // true

Other packages similar to @turf/boolean-intersects

Keywords

FAQs

Package last updated on 09 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc